#pragma once

#pragma warning(push)
#pragma warning( disable: 4996)

#ifndef LUA_MANAGER_H_
#define LUA_MANAGER_H_

#include <LuaPlus.h>

class LuaManager
{
/************************************************************************/
/* SINGLETON MANAGER CLASS                                              */
/************************************************************************/
private:
    LuaManager(){}
    LuaManager(const LuaManager& other) {}
    ~LuaManager(){}
    void operator=(const LuaManager& other) {}
/************************************************************************/
/* The Singleton Functions                                              */
/************************************************************************/
public:
    static LuaManager* Instance()
    {
        static LuaManager inst;
        return &inst;
    }
/************************************************************************/
/* PUBLIC INTERFACE                                                     */
/************************************************************************/
public:
    bool Initialize()
    {
        m_stateOwner->OpenLibs();
        return true;
    }
    void ShutDown(){}
    bool OpenFile(const char* fileName);
    LuaPlus::LuaStateOwner& GetOwner() { return m_stateOwner;}
    
    /************************************************************************/
/*                                                                      */
/************************************************************************/
private:
    LuaPlus::LuaStateOwner m_stateOwner;
};

namespace LUA_IMPLEMENTATION
{
#define LUA_REGISTER(name,cls,adr){Static_MetaTable->RegisterObjectDirect(name, (cls*)0, adr);}
};


#endif //Lua_Manager_H_

#pragma warning(pop) //Disable 4996
